package com.example.book.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.book.service.IFinishService;
import com.example.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 凡哥哥
 * @since 2023-11-07
 */
@RestController
@RequestMapping("/finish")
@Api(tags = "完结图书控制器")
public class FinishController {
    @Autowired
    private IFinishService FinishService;
    /**
     * 查询图书类型
     *
     * @param page
     * @param pageSize
     * @param name
     * @return
     */
    @ApiOperation(value = "查询图书类型")
    @GetMapping("/page")
    public ResponseResult<Page> pageInfo(Integer page, Integer pageSize, String name){
        return FinishService.pageInfo(page, pageSize, name);
    }

    /**
     * 完结榜图书详细查询
     * @return
     */
    @ApiOperation(value = "完结榜图书详细查询")
    @GetMapping("/finishAll")
    public ResponseResult recommendAll(){
        return FinishService.finishAll();
    }
    /**
     * 删除
     * @param ids
     * @return
     */
    @ApiOperation(value = "删除")
    @DeleteMapping
    public ResponseResult deleteRecommend(int[] ids) {
        FinishService.deleteFinish(ids);
        return ResponseResult.okResult("图书推荐删除成功");
    }

}

